<template>

	<view class="content">
		<view v-if="current != 0" class="">
			<!-- 2.0.19支持autoBack，默认为false -->
			<u-navbar leftText="邻里商城" leftIcon="https://s1.ax1x.com/2022/05/27/Xmd7in.png" :autoBack="true">
			</u-navbar>
		</view>
		<view>
			<view v-if="current == 0" style="width: 100%;">
				<home></home>
			</view>
			<view v-if="current == 1" style="width: 100%;">
				<nav-menu></nav-menu>
			</view>
			<view v-if="current == 2" style="width: 100%;">
				<cart></cart>
			</view>
			<view v-if="current == 3" style="width: 100%;">
				<mine></mine>
			</view>
		</view>


		<u-tabbar :value="current" @change="beforeSwitch" activeColor="#333" :customStyle="{zIndex: '10'}">
			<u-tabbar-item text="首页" style="background-color: #F8F8F8;">
				<image class="u-page__item__slot-icon" slot="active-icon" src="https://resourse.cnlhjt.com/upload/20221012/31d797bd9e1d2355a86335b795c12537.png"
					style="height: 50rpx;" mode="heightFix"></image>
				<image class="u-page__item__slot-icon" slot="inactive-icon" src="https://resourse.cnlhjt.com/upload/20221012/4c946b8a7c284deb564e3860a82b9239.png"
					style="height: 50rpx;" mode="heightFix"></image>
			</u-tabbar-item>
			<u-tabbar-item text="分类" style="background-color: #F8F8F8;">
				<image class="u-page__item__slot-icon" slot="active-icon" src="https://resourse.cnlhjt.com/upload/20221012/957e3831180bf6fab69d373772717df5.png"
					style="height: 50rpx;" mode="heightFix"></image>
				<image class="u-page__item__slot-icon" slot="inactive-icon" src="https://resourse.cnlhjt.com/upload/20221012/8946407737ae089f9acaf795b30f03d6.png"
					style="height: 50rpx;" mode="heightFix"></image>
			</u-tabbar-item>
			<u-tabbar-item text="购物车" style="background-color: #F8F8F8;">
				<image class="u-page__item__slot-icon" slot="active-icon" src="https://resourse.cnlhjt.com/upload/20221012/5349f8d8b6adb14edae3aa617a9bbba6.png"
					style="height: 50rpx;" mode="heightFix"></image>
				<image class="u-page__item__slot-icon" slot="inactive-icon" src="https://resourse.cnlhjt.com/upload/20221012/38c0c7509fa7b16ee17c14768e7d4230.png"
					style="height: 50rpx;" mode="heightFix"></image>
			</u-tabbar-item>
			<u-tabbar-item text="我的" style="background-color: #F8F8F8;">
				<image class="u-page__item__slot-icon" slot="active-icon" src="https://resourse.cnlhjt.com/upload/20221012/dfb30cd73c9b741d2066cb796a56e25c.png"
					style="height: 50rpx;" mode="heightFix"></image>
				<image class="u-page__item__slot-icon" slot="inactive-icon" src="https://resourse.cnlhjt.com/upload/20221012/1765b1ac3719c2ae11ff8a56907a2d68.png"
					style="height: 50rpx;" mode="heightFix"></image>
			</u-tabbar-item>
		</u-tabbar>
	</view>
</template>

<script>
	import home from "@/pagesShop/index/home.vue";
	import navMenu from "@/pagesShop/index/nav.vue";
	import cart from "@/pagesShop/index/cart.vue";
	import mine from "@/pagesShop/index/mine.vue";
	export default {
		data() {
			return {
				current: 0
			}
		},
		components: {
			home: home,
			navMenu: navMenu,
			cart: cart,
			mine: mine
		},
		onLoad(options) {
			if(options.cut){
				this.current = options.cut;
			}
		},
		methods: {
			beforeSwitch(index) {
				if (this.current !== index) {
					this.toTop();
				}
				this.current = index;

			},

			toTop() {
				uni.pageScrollTo({
					scrollTop: 0,
					duration: 100
				});
			},
		}
	}
</script>

<style>
</style>
